<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Music Player</title>
    <link rel="stylesheet" href="../assets/css/normalize.css">
    <link rel="stylesheet" href="../assets/css/font-awesome.css">
    <link rel="stylesheet" href="../assets/css/app.css">
    <!-- <link href="http://fonts.useso.com/css?family=Open+Sans:400,300" rel="stylesheet" type="text/css"> -->
</head>

<body class="page">
    <div id="app" class="page">
        <header class="header">
            <router-link :to="{name :'home'}"><i class="fa fa-cloud"></i></router-link>
            <h1><i class="fa fa-music"></i> Music Player</h1>
            <router-link :to="{name :'songs'}"><i class="fa fa-th-list"></i></router-link>
        </header>
        <section class="main">
            <router-view></router-view>
        </section>
    </div>
    <script id="home_tmpl" type="text/v-template">
        <img src="../assets/img/home.png" alt="" width="100%">
    </script>
    <script id="list_tmpl" type="text/v-template">
        <div class="list">
            <ol>
                <li v-for="player in list">
                    <router-link :to="{ name:'player', params:{id: player.id }}" tag="a">
                        <span class="num">{{pad(player.id, 3)}}</span>
                        <div class="info">
                            <h3 class="title">{{player.name}}</h3>
                            <span class="artist">{{player.artist}}</span>
                        </div>
                        <span class="duration">{{convert(player.duration)}}</span>
                        <div class="photo"><img :src="player.poster"></div>
                    </router-link>
                </li>
            </ol>
        </div>
    </script>
    <script id="player_tmpl" type="text/v-template">
        <div>
            <div class="loading" v-if="loading">
                Loading...
            </div>
            <div v-if="error" class="error">
                {{ error }}
            </div>

            <div v-if="player" class="player">
                <div class="disc">
                    <img :src="player.poster" :alt="player.name" :style="{transform:'rotate(' + (player.current/player.duration*360*2) + 'deg)'}">
                    <span class="duration">{{convert(player.duration-player.current)}}</span>
                </div>
                <h2 class="title">{{player.name}}</h2>
                <h3 class="artist">{{player.artist}}</h3>
                <div class="lyric">
                    <p class="previous">人如天上的明月是不可拥有</p>
                    <p class="current">情如曲过只遗留无可挽救再分别</p>
                    <p class="next">为何只是失望填密我的空虚</p>
                </div>
                <input type="range" value="0" min="0" :max="player.duration" v-model="player.current" @change="progress()">
                <div class="controls">
                    <button><i class="fa fa-retweet"></i></button>
                    <button class="active" @click="prev()"><i class="fa fa-backward"></i></button>
                    <button class="active" @click="play()"><i class="fa" :class="{'fa-play':!player.playing, 'fa-pause':player.playing}"></i></button>
                    <button class="active" @click="next()"><i class="fa fa-forward"></i></button>
                    <button class="active"><i class="fa fa-random"></i></button>
                </div>
            </div>
        </div>
    </script>
    <script src="../libs/vue/vue.js"></script>
    <script src="../libs/vue-router/vue-router.js"></script>
    <script src="../libs/vue-resource/vue-resource.js"></script>
    <script src="app.js"></script>
</body>

</html>